﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

namespace Danser_AJAXEnabledWebApplication.Faults
{
    /// <summary>
    /// Page to display a system error occured while processing a request
    /// </summary>
    public partial class GenericErrorPage : System.Web.UI.Page
    {
        /// <summary>
        /// Keys used to save in session the system error occured during executing the request
        /// </summary>
        public const String SESSION_ERROR_KEY = "ErrorString";
        /// <summary>
        /// the session URL key
        /// </summary>
        public const String SESSION_ERROR_PAGE_URL_KEY = "~/Faults/GenericErrorPage.aspx";

        /// <summary>
        /// loads the page...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //get the exception Session
            Exception exception = Session[SESSION_ERROR_KEY] as Exception;
            
            //populate error details
            causedByLiteral.Text = exception.Message;
            
            innerExceptionLiteral.Text = 
                exception.InnerException != null ? exception.InnerException.Message : "None";
            
            stackTraceLiteral.Text = exception.StackTrace;

            
        }
    }
}
